package cn.zyq.ykb.controller.h5.pay;

import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.service.pay.PayOrderService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 支付订单Controller
 *
 * @author SystemAuth
 * @date 2023-06-01
 */

@RestController(value = "H5PayOrderController")
@RequestMapping("/api/payOrder")
@Api(tags = "支付订单接口")
public class PayOrderController extends BaseController {

    @Autowired
    private PayOrderService payOrderService;

    /**
     * 微信付款成功或失败回调接口
     * <p>
     *
     * @param request  请求内容
     * @param response 响应内容
     * @return 操作结果
     */
    @PostMapping("wxPayNotify")
    public Object wxPayNotify(HttpServletRequest request, HttpServletResponse response){
        return payOrderService.wxPayNotify(request, response);
    }

    /**
     * 支付宝付款成功或失败回调接口
     * <p>
     *
     * @param request  请求内容
     * @param response 响应内容
     * @return 操作结果
     */
    @PostMapping("aliPayNotify")
    public Object aliPayNotify(HttpServletRequest request, HttpServletResponse response){
        return payOrderService.aliPayNotify(request, response);
    }

    /**
     * 退款成功或失败回调接口
     * <p>
     *
     * @param request  请求内容
     * @param response 响应内容
     * @return 操作结果
     */
    @PostMapping("returnNotify")
    public Object returnNotify(HttpServletRequest request, HttpServletResponse response){
        return payOrderService.returnNotify(request, response);
    }

}
